﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucNavigationMenu.ascx.cs"
	Inherits="CANO.WebSite.UserControls.ucNavigationMenu" %>
	<%-- <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>  --%>
	   <%--<script src="../js/jquery-1.8.2.js" type="text/javascript"></script>
	<script src="../js/jquery-ui-1.9.1.custom.min.js" type="text/javascript"></script>
	<link href="//css/jqui/jquery-ui-1.9.1.custom.css" type="text/css" rel="stylesheet" />--%>
	  <script src="../js/jquery-1.8.2.js" type="text/javascript"></script>
	<script src="../js/jquery-ui-1.9.1.custom.min.js" type="text/javascript"></script>
	<link href="../css/jqui/jquery-ui-1.9.1.custom.css" type="text/css" rel="stylesheet">
<div id="nav">
	<div class="inner-container clearfix">
		<div id="h-wrap" style="width:250px;">
			<div class="inner">
				<h2>
					<span id="currentHeaderModuleImage" class="h-ico ico-dashboard"><span id="currentModuleText">
						Inicio</span></span> <span class="h-arrow"></span>
				</h2>
				<ul class="clearfix">
					<!-- Admin sections - feel free to add/modify your own icons are located in "css/img/h-ico/*" -->
					<li><a href="../Index.aspx" class="h-ico ico-dashboard"><span>Inicio</span></a></li>
					<li><a href="../contacts/contacts.aspx" class="h-ico ico-users"><span>Contactos</span></a></li>
					<li><a href="../Compromisos/Compromisos.aspx" class="h-ico ico-edit "><span>Compromisos</span></a></li>
					<li><a href="../Inbox/Inbox.aspx" class="h-ico ico-comments"><span>Bandeja de Entrada</span></a></li>
					<!--ToDo: Hacer que valide si es Admin -->
					<asp:Panel ID="pnlSiteAdmin" runat="server" Visible="false" >
						<li><a href="../Admin/Admin.aspx" class="h-ico ico-advanced"><span>Backoffice</span></a></li>
					</asp:Panel>
				</ul>
			</div>
		</div>
		<!-- #h-wrap -->
		<form>
		<!-- Search form -->
		<fieldset>
		
			<input type="text" value="Buscar Contacto…" size="20" class="text fl" 
				style="color: rgb(153, 153, 153);">

			<input type="image" alt="Search" src="../css/img/search-button.png" id="btnSearch">
			<input type="hidden" class="hiddenIDContactResult" id="hiddenIDContactResult" value="" runat="server" enableviewstate="true" />
		</fieldset>
		</form>
	</div>

	<input type="hidden" runat="server" id="currentModule" />
	<input type="hidden" runat="server" id="currentUserID" />
</div>
		<script type="text/javascript">

			$(".text.fl").focus(function () {
				if ($(this).attr('value') == "Buscar Contacto…") {
					$(this).css('color', '#555');
					$(this).attr('value', '');
				}
			});

			$(".text.fl").blur(function () {
				if ($(this).attr('value') == '') {
					$(this).attr('value', "Buscar Contacto…");
					$(this).css('color', '#999');
				}
			});

			var currentUserId = $('input[id*="currentUserID"]').val();

			$(document).ready(function () {
				$(function () {
					$(".text.fl").autocomplete({
						source: function (request, response) {
							$.ajax({
								url: "/EmployeeList.asmx/FetchEmailList",
								data: "{ 'mail': '" + request.term + "', 'userId' : '" + currentUserId + "' }",
								dataType: "json",
								type: "POST",
								contentType: "application/json; charset=utf-8",
								dataFilter: function (data) { return data; },
								success: function (data) {
									response($.map(data.d, function (item) {
										return {
											value: item.FullName,
											id: item.ContactoID
										}
									}))
								},
								error: function (XMLHttpRequest, textStatus, errorThrown) {
									alert("No existen coincidencias con el texto ingresado.");
									//alert(textStatus);
								}
							});
						},
						select: function (event, ui) {
							$(".hiddenIDContactResult").val(ui.item.id);
						},
						minLength: 2
					});
				});

				$("#btnSearch").click(function () {
					var test = $(".hiddenIDContactResult").val();
		
				});


				if (window.location.pathname.toLowerCase().indexOf("index") != -1)
				{
					$("#currentHeaderModuleImage").toggleClass("ico-dashboard");
					$("#currentModuleText").text("Inicio");
				}
				else if (window.location.pathname.toLowerCase().indexOf("admin") != -1) {
				    $("#currentHeaderModuleImage").toggleClass("ico-advanced");
				    $("#currentModuleText").text("Backoffice");
				}
				else if (window.location.pathname.toLowerCase().indexOf("contacts") != -1)
				{
					$("#currentHeaderModuleImage").toggleClass("ico-users");
					$("#currentModuleText").text("Contactos");
				}
				else if (window.location.pathname.toLowerCase().indexOf("compromisos") != -1) {
					$("#currentHeaderModuleImage").toggleClass("ico-edit");
					$("#currentModuleText").text("Compromisos");
				}
				else if (window.location.pathname.toLowerCase().indexOf("inbox") != -1) {
					$("#currentHeaderModuleImage").toggleClass("ico-comments");
					$("#currentModuleText").text("Inbox");
				}
				
				else {
					$("#currentHeaderModuleImage").toggleClass("ico-dashboard");
					$("#currentModuleText").text("Inicio");
				}
			});
        </script>